# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils qt4 flag-o-matic
MY_PN="${PN/qutim-/}"

DESCRIPTION="Protocolicon plugin for net-im/qutim"
HOMEPAGE="http://www.qutim.org"
LICENSE="GPL-2"

SRC_URI="http://www.qutim.org/uploads/src/plugins/${MY_PN}-${PV}.tar.bz2
	http://www.svtdpi.com.ua/sqee/qutim/plugins/${MY_PN}-${PV}.tar.bz2"

SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
IUSE="debug"

RDEPEND=">=net-im/qutim-0.2"
DEPEND="${RDEPEND}"

RESTRICT="mirror
	debug? ( strip )"

S="${WORKDIR}/${MY_PN}-${PV}"

src_prepare()
{
	if (use debug) ; then
                unset CFLAGS CXXFLAGS
                append-flags -O1 -g -ggdb
        fi

	sed -i '6a\INCLUDEPATH += /usr/include\' ${S}/protocolicon.pro
}

src_compile()
{
	eqmake4 ${MY_PN}.pro || die "configure plugin failed"
	emake || die "make plugin failed"
}

src_install()
{
	insinto /usr/$(get_libdir)/qutim
	doins "${WORKDIR}/lib${MY_PN}.so" || die "Plugin installation failed"
}
